
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:zfth/api/AlarmApi.dart';
import 'package:zfth/api/RepairApi.dart';

import '../../components/form/LFormLogic.dart';
import '../../components/form/LFormPage.dart';
import '../../components/list/LCellListLogic.dart';
import '../../utils/Settings.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

import '../../utils/StoreData.dart';



class RepairLogDetailPage extends StatefulWidget{

  const RepairLogDetailPage({super.key});

  @override
  State<RepairLogDetailPage> createState() =>RepairLogDetailState();

}

class RepairLogDetailState extends State<RepairLogDetailPage> with AutomaticKeepAliveClientMixin{

  String formTag = "RepairLogDetail";
  late final LFormLogic lFormLogic;
  bool keepAlive = true;
  List formItems = [
    {"field":'deviceRegion',"label":'区域',"component":'select',"readonly":true,"required":false,"isShowLabel":true,"dictCode":Settings.dictCodes["区域"]},
    {"field":'deviceRoom',"label":'配电室',"component":'select',"readonly":true,"required":false,"isShowLabel":true,"dictCode":Settings.dictCodes["配电室"]},
    {"field":'deviceName',"label":'设备名称',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'deviceNo',"label":'设备编码',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'deviceType',"label":'设备类型',"component":'select',"readonly":true,"required":false,"isShowLabel":true,"dictCode":Settings.dictCodes["设备类型"]},
    {"field":'repairTime',"label":'报修时间',"component":'datetime',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'repairCause',"label":'报修原因',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'repairEmpName',"label":'报修人',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'maintainDesc',"label":'维修说明',"component":'input',"readonly":true,"required":true,"isShowLabel":true,"maxLines":3},
    {"field":'maintainEmpName',"label":'维修人',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'maintainTime',"label":'维修时间',"component":'datetime',"readonly":true,"required":false,"isShowLabel":true},



  ];
  Map formData={};
  late String returnTag;


  @override
  void initState() {
    //获取页面传入的参数
    formData=Get.arguments["item"];

    returnTag = Get.arguments["tag"];

    lFormLogic = Get.put(LFormLogic(),tag:formTag);
    lFormLogic.init(formItems: formItems, formData: formData,tag: formTag,onChangeCallback: onChange);

    super.initState();
  }





  @override
  void dispose() {
    Get.delete<LFormLogic>(tag: formTag);
    super.dispose();
  }

  @override
  bool get wantKeepAlive => keepAlive;
  bool isShowButton = true;

  ///内容改变后的回调
  void onChange(re){}


  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
        backgroundColor: Settings.backgroundColor,
        appBar: AppBar(
          title: const Text("终端维修详情"),
          centerTitle: true,
          elevation: 0,
        ),
        body: SingleChildScrollView(
          child: Stack(
            children: [
              Column(
                children: [
                  LFormPage(tag:formTag),

                ],
              ),
            ],
          ),
        )




    );
  }


}